package com.zygh.policeasset.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zygh.policeasset.mapper.UnitMapper;
import com.zygh.policeasset.pojo.Unit;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/service/UnitService.class */
public class UnitService {
    @Autowired
    UnitMapper unitMapper;

    public List<Unit> findAll(String type) {
        return this.unitMapper.findAll(type);
    }

    public PageInfo listFindAll(String type, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(this.unitMapper.findByType(type));
    }

    public List<Unit> findByType(String type) {
        return this.unitMapper.findByType(type);
    }

    public Integer findUnitByTypeAndUnit(String type, String unitNum, String unitName) {
        return this.unitMapper.findUnitByTypeAndUnit(type, unitNum, unitName);
    }

    public Integer add(Unit unit) {
        return Integer.valueOf(this.unitMapper.add(unit));
    }

    public Integer update(Unit params) {
        return Integer.valueOf(this.unitMapper.updateById(params));
    }

    public Integer remove(int id) {
        return Integer.valueOf(this.unitMapper.deleteById(Integer.valueOf(id)));
    }

    public String findOneByName(String type, String unitName) {
        return this.unitMapper.findOneByName(type, unitName);
    }
}